<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
    <?php include("../template/$OJ_TEMPLATE/css.php");?>


    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<script>
    function delSolution(id,userName)
    {
        var getkeyVal = document.getElementById('getkey').value;
        var ret = confirm('Delete '+id+' ['+userName+']?');
        if( ret ){
            location.href="status_del.php?solution_id="+id+"&getkey="+getkeyVal;
        }
    }
</script>
<input id="getkey" style="display: none;" value=<?php echo $_SESSION['getkey'] ?> />
<h3 align="center">状态列表</h3>
<div class="container">
    <!-- Main component for a primary marketing message or call to action -->
    <div class="jumbotron">
        <div align=center class="input-append">
            <form id=simform class=form-inline action="status_list.php" method="get">
                <?php
                $pid_str = "";
                if ($problem_id > 0 ) {
                    $pid_str = strval($problem_id);
                }
                ?>
                题目编号: <input class="form-control" type=text size=4 name=problem_id value='<?php echo  htmlspecialchars($pid_str, ENT_QUOTES) ?>'>
                &nbsp;&nbsp;用户:<input class="form-control" type=text size=4 name=user_id value='<?php echo  htmlspecialchars($user_id, ENT_QUOTES) ?>'>

                &nbsp;&nbsp;语言:
                <select class="form-control" size="1" name="language">
                    <?php if (isset($_GET['language'])) $language=intval($_GET['language']);
                    else $language=-1;
                    if ($language<0||$language>=count($language_name)) $language=-1;
                    if ($language==-1) echo "<option value='-1' selected>All</option>";
                    else echo "<option value='-1'>All</option>";
                    $i=0;
                    foreach ($language_name as $lang){
                        if ($i==$language)
                            echo "<option value=$i selected>$language_name[$i]</option>";
                        else
                            echo "<option value=$i>$language_name[$i]</option>";
                        $i++;
                    }
                    ?>
                </select>
                结果:
                <select class="form-control" size="1" name="jresult">
                    <?php if (isset($_GET['jresult'])) $jresult_get=intval($_GET['jresult']);
                    else $jresult_get=-1;
                    if ($jresult_get>=12||$jresult_get<0) $jresult_get=-1;
                    if ($jresult_get==-1) echo "<option value='-1' selected>All</option>";
                    else echo "<option value='-1'>All</option>";
                    for ($j=0;$j<12;$j++){
                        $i=($j+4)%12;
                        if ($i==$jresult_get) echo "<option value='".strval($jresult_get)."' selected>".$jresult[$i]."</option>";
                        else echo "<option value='".strval($i)."'>".$jresult[$i]."</option>";
                    }
                    echo "</select>";
                    ?>
                </select>
                <input type=submit class='form-control' value=查找></form>
        </div>
        <div id=center>
            <table id=result-tab class="table table-striped content-box-header" align=center width=80%>
                <thead>
                <tr class='toprow' >
                    <th ><?php echo $MSG_RUNID?>
                    <th ><?php echo $MSG_USER_ID ?>
                    <th ><?php echo $MSG_USER_NAME?>
                    <th ><?php echo $MSG_PROBLEM?>
                    <th ><?php echo $MSG_RESULT?>
                    <th class='hidden-xs' ><?php echo $MSG_MEMORY?>
                    <th class='hidden-xs' ><?php echo $MSG_TIME?>
                    <th><?php echo $MSG_LANG?>
                    <th class='hidden-xs' ><?php echo $MSG_CODE_LENGTH?>
                    <th>操作
                    <th class='hidden-xs' ><?php echo $MSG_SUBMIT_TIME?>
                </tr>
                </thead>
                <tbody>
                <?php
                $cnt=0;
                foreach($view_status as $row){
                    if ($cnt)
                        echo "<tr class='oddrow'>";
                    else
                        echo "<tr class='evenrow'>";
                    $i=0;
                    foreach($row as $table_cell) {
                        if( $i>3 && $i!=7 && $i!=9 )
                            echo "<td class='hidden-xs'>";
                        else
                            echo "<td>";
                        echo $table_cell;
                        echo "</td>";
                        $i++;
                    }
                    echo "</tr>\n";
                    $cnt=1-$cnt;
                }
                ?>
                </tbody>
            </table>
        </div>

    </div>

</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<?php include("../template/$OJ_TEMPLATE/js.php");?>
<script>var i=0;
    var judge_result=[<?php
        foreach($judge_result as $result){
            echo "'$result',";
        }
        ?>''];

    var judge_color=[<?php
        foreach($judge_color as $result){
            echo "'$result',";
        }
        ?>''];
</script>
<script src="../template/<?php echo $OJ_TEMPLATE?>/auto_refresh.js?v=0.21" ></script>
</body>
</html>
